//导入request.js请求工具
import request from '@/utils/request'
// import { useTokenStore } from '@/stores/token';

//获取文章分类
export const getArticleCategoryService = ()=>{
    // const userToken = useTokenStore();
    //在pinia中定义的响应式变量不需要添加.value
    // return request.get('/category', {headers:{Authorization: userToken.token}});
    return request.get('/category');
}
//添加文章分类
export const addArticleCategoryService = (data)=>{
    return request.post('/category', data);
}
//修改文章分类
export const updateArticleCategoryService = (data)=>{
    return request.put('/category', data);
}
//删除文章分类
export const deleteArticleCategoryService = (id)=>{
    return request.delete('/category?id='+id);
}

//获取文章列表
export const getArticleListService = (data)=>{
    return request.get('/article', {params: data});
}

//添加文章详情
export const addArticleService = (data)=>{
    return request.post('/article', data);
}

//修改文章详情
export const updateArticleService = (data)=>{
    console.log(data);
    return request.put('/article', data);
}

//删除文章详情
export const deleteArticleService = (id)=>{
    return request.delete('/article?id='+id);
}